﻿@{
    ViewBag.Title = "Home Page";
}
@section Menu{
    <ul class="nav">
        <li class="">@Html.Partial("~/Views/Menu/Execution.cshtml", new ViewDataDictionary())
        </li>
    </ul>
}
<script type="text/javascript">
    $(function () {
        $("#refreshMachines").click();
        //$("#refreshExecutions").click();
    });

    function toggleDivShowMachines() {
        $('#divShowMachines').toggle();
    }

    function showMachinesLoad() {
        $("#divMachines").css("background", '#FFFFFF url(@Url.Content("~/Content/img/icons/Loading.gif")) no-repeat center center;');
        toggleDivShowMachines();
    }

    function hideMachinesLoad() {
        $("#divMachines").css("background", "#FFFFFF");
        toggleDivShowMachines();
    }
    
</script>
@*@Html.ActionLink("Test Execution Service", "TestExecutionService")
<br />
@Html.ActionLink("Test Monitor Service", "TestMonitorService")
<br />
@Html.ActionLink("Run Scheduler", "RunScheduler")*@
<div id="divMachines" style="width: 600px; height: 300px;">
    <h3>
        Machine Dashboard</h3>
    <div id="divShowMachines">
    </div>
    <div style="margin-right: 70px;">
        @Ajax.ActionLink("Refresh", "CurrentExecution", "Machine", null,
            new AjaxOptions
            {
                //LoadingElementId = "loadingMachines",
                UpdateTargetId = "divShowMachines",
                InsertionMode = InsertionMode.Replace,
                //OnBegin = "toggleDivShowMachines",
                //OnComplete = "toggleDivShowMachines"
                OnBegin = "showMachinesLoad",
                OnComplete = "hideMachinesLoad"
            },
            new
            {
                id = "refreshMachines",
                style = "float:right; width:30px; background: url('/Content/img/icons/refresh-icon.png') no-repeat "
            })
    </div>
</div>
<div id="divTopExecutions">
    @Html.Partial("~/Views/Home/TopExecutions.cshtml")
</div>
<div class="clear">
</div>
<div style="width: 910px">
    @Ajax.ActionLink("Refresh", "TopExecutions", "Home", null,
    new AjaxOptions
    {
        //LoadingElementId = "loadingMachines",
        UpdateTargetId = "divTopExecutions",
        InsertionMode = InsertionMode.Replace,
        //OnBegin = "toggleDivShowMachines",
        //OnComplete = "toggleDivShowMachines"
    },
    new
    {
        id = "refreshExecutions",
        style = "float:right; width:30px; background: url('/Content/img/icons/refresh-icon.png') no-repeat "
    })
    @Html.ActionLink("View All", "TodayExecutions", "RoutineExecution", null, new { style = "float:right; margin-right:10px;" })
</div>
